home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!rs
- From: rs@uunet.UU.NET (Rich Salz)
- Newsgroups: comp.sources.unix
- Subject: v10i043: Patches to Logo for Suntools
- Message-ID: <583@uunet.UU.NET>
- Date: 7 Jul 87 23:23:24 GMT
- Organization: UUNET Communications Services, Arlington, VA
- Lines: 915
- Approved: rs@uunet.uu.net
-
- Submitted by: cochon@Sun.COM (Philippe Lacroute)
- Mod.sources: Volume 10, Number 43
- Archive-name: logo/Patch01
-
- [ The Sun version in the original posting needed a graphics library
- developed at Lucasfilm; here's something more useful. --r$ ]
-
- This file contains instructions for creating a version of Logo to run
- under Suntools. You need four new files which follow below: sun.i,
- logo.c, logo.icon and Makefile. The following changes must be made to
- the logo source as well. I believe the line numbers refer to version 4
- source but hopefully with the context given for each change it won't
- matter. "Make" will produce two binaries: logo and logotool. When
- running logo under suntools use logotool instead of logo (logotool
- actually creates a window and then forks logo to run in it; logotool
- then handles repaint requests for the tool).
-
- Note: the routines in sun.i currently only support monochrome graphics
- (although it would not be difficult to add color). I made these
- changes several years ago and I haven't devoted any time to the code
- since then, but they still compile under any version of SunOS from 1.0
- on (that's when SunWindows was introduced).
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: logo.mods sun.i logo.c logo.icon Make.Sun
- # Wrapped by rsalz@uunet.uu.net on Tue Jul 7 12:27:11 1987
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f logo.mods -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"logo.mods\"
- else
- echo shar: Extracting \"logo.mods\" \(2328 characters\)
- sed "s/^X//" >logo.mods <<'END_OF_logo.mods'
- XThe first two changes add the commands fill and textsize. Fill fills in the
- Xregion around the current position of the turtle using the current pen color.
- XThe boundary of the fill can be an arbitrary shape (for instance:
- X"repeat 4 [fd 100 rt 90] rt 45 fd 10 fill" produces a black square). If the
- Xboundary has "holes", the whole screen may get filled. Textsize takes one
- Xargument which is the number of lines you want the text window to be in split
- Xmode.
- X
- Xlogo.y:98 insert 3 lines
- X #ifdef SETCURSOR
- X struct object *clrtxt(), *setcur();
- X #endif
- X -> #ifdef SUN
- X -> struct object *fill_region(), *text_size();
- X -> #endif
- X
- X struct lexstruct keywords[] =
- X {
- X
- X
- Xlogo.y:203 insert 4 lines
- X
- X "scrunch",NOOP,scrunch,NULL,
- X "setscrunch",ONECOM,setscrunch,"setscrun",
- X -> #ifdef SUN
- X -> "fill",NOCOM,fill_region,NULL,
- X -> "textsize",ONECOM,text_size,"ts",
- X -> #endif
- X #endif
- X "toplevel",NOCOM,ltopl,NULL,
- X "fprint",ONECOM,cmfprint,"fp",
- X
- X
- Xlogoparse.c:142 add 3 lines
- X
- X else if (ibufptr==NULL) {
- X rebuff:
- X -> #ifdef SUN
- X -> sigwinch_on();
- X -> #endif
- X if ((c=read(0,ibuf,IBUFSIZ))==IBUFSIZ)
- X if (ibuf[IBUFSIZ-1]!='\n') {
- X
- X
- Xlogoparse.c:152 add 3 lines
- X
- X puts("Your line is too long.");
- X errhand();
- X }
- X -> #ifdef SUN
- X -> sigwinch_off();
- X -> #endif
- X if (c<0) {
- X /* Error return from read. Probably signal.*/
- X return ('\n');
- X
- Xprocedit.c:107 add 3 lines
- X
- X static char editname[20] = "";
- X static char *editor;
- X -> #ifdef SUN
- X -> int sig_mask;
- X -> #endif
- X
- X if (editname[0] == '\0') {
- X editor = getenv("EDITOR");
- X
- X
- Xprocedit.c:107 add 3 lines
- X
- X fflush(stdout);
- X signal(SIGINT,SIG_IGN);
- X signal(SIGQUIT,SIG_IGN);
- X -> #ifdef SUN
- X -> sig_mask = sigblock(1 << (SIGWINCH-1));
- X -> #endif
- X switch (pid=fork()) {
- X case -1:
- X printf("\nCan't fork to editor.\n");
- X
- Xprocedit.c:120 add 3 lines
- X default:
- X while (wait(&status) != pid) ;
- X -> #ifdef SUN
- X -> sigsetmask(sig_mask);
- X -> #endif
- X }
- X if (status&0177400) {
- X
- X
- Xturtle.c:384 add 3 lines
- X
- X errhand();
- X }
- X if (turtdes == 0) dpyinit(); /* free turtle "display */
- X -> #ifdef SUN
- X -> checkwindow();
- X -> #endif
- X }
- X
- X NUMBER posangle(angle)
- X
- END_OF_logo.mods
- if test 2328 -ne `wc -c <logo.mods`; then
- echo shar: \"logo.mods\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f sun.i -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"sun.i\"
- else
- echo shar: Extracting \"sun.i\" \(11542 characters\)
- sed "s/^X//" >sun.i <<'END_OF_sun.i'
- X
- X/* Include file for turtle.c for Sun Microsystems workstation */
- X
- X/* modified for use with 2.0 SunWindows by Philippe Lacroute */
- X
- X/* must be loaded -lsuntool -lsunwindow -lpixrect */
- X
- X#include <suntool/tool_hs.h>
- X#include <fcntl.h>
- X#include <signal.h>
- X
- X/* Window system variables and functions */
- X
- X#define CLR PIX_CLR
- X#define SET PIX_SET
- X#define INVERT PIX_SRC ^ PIX_DST
- X#define SPLIT_TEXT_SIZE 5 /* default # lines of text in split mode */
- X#define BORDER 5 /* width of the window borders */
- X#define SCREEN_DEPTH 1
- X#define FIX_PICTURE 1
- X#define FIX_SIZE 2
- X
- X#define ltos_xcor(c) c + scalex /* conversion: logo to window */
- X#define ltos_ycor(c) scaley - c /* system coordinates */
- X
- Xstatic short logocur_data[16] = {
- X 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0000, 0x0000, 0xF83E,
- X 0x0000, 0x0000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0000
- X};
- X
- Xmpr_static(logocur_pr, 16, 16, 1, logocur_data);
- X
- Xstruct cursor logocur = { 7, 7, PIX_SRC ^ PIX_DST, &logocur_pr };
- X
- Xstatic setwinchflag();
- Xextern char pr_reversesrc[];
- Xint screen_height, screen_width;/* size for retained pixrect */
- Xint gfx_windowfd = -1; /* window device (blanket) */
- Xint real_gfx_fd; /* gfx window parent */
- Xstruct pixwin *gfx_pixwin; /* actual window */
- Xint gfx_flags = 0; /* used for SIGWINCH */
- Xint parentfd; /* toll window */
- Xint textfd; /* text window */
- Xint scalex, scaley;
- Xint font_height;
- Xint tlines = SPLIT_TEXT_SIZE;
- Xstruct rect tool_rect;
- Xint sigwinch_ok = 0;
- Xint mouse_x = -1, mouse_y = -1; /* current location of mouse (screen coor.) */
- Xint mousein = 0;
- X
- Xint sunpens[] = {SET, CLR, INVERT};
- Xchar state; /* What state we are in (text, split, full) */
- XNUMBER sunoldx,sunoldy;
- X
- Xint sunturt(),sunfrom(),sunto(),suninit(),sunstate();
- X
- Xstruct display sun = {
- X 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1, /* dims initialized later */
- X "", "", "", "", sunturt, sunfrom, sunto, nullfn, suninit, nullfn,
- X nullfn, nullfn, nullfn, sunstate
- X};
- X
- X#define transline(op,fx,fy,tx,ty) pw_vector(gfx_pixwin, ltos_xcor(fx), ltos_ycor(fy), ltos_xcor(tx), ltos_ycor(ty), op, 1)
- X
- Xsunturt(hide)
- Xint hide; /* 1 to erase */
- X{
- X NUMBER newx, newy, oldx, oldy, angle;
- X static double scrunch = 1.0;
- X
- X if (!hide)
- X scrunch = yscrunch;
- X angle = (mydpy->turth-90.0)*3.141592654/180.0;
- X oldx = mydpy->turtx + 15.0*sin(angle);
- X oldy = mydpy->turty + 15.0*cos(angle);
- X angle = mydpy->turth*3.141592654/180.0;
- X newx = mydpy->turtx + 15.0*sin(angle);
- X newy = mydpy->turty + 15.0*cos(angle);
- X transline(INVERT,(int)oldx,(int)(scrunch*oldy),
- X (int)newx,(int)(scrunch*newy));
- X oldx = newx;
- X oldy = newy;
- X angle = (mydpy->turth+90.0)*3.141592654/180.0;
- X newx = mydpy->turtx + 15.0*sin(angle);
- X newy = mydpy->turty + 15.0*cos(angle);
- X transline(INVERT,(int)oldx,(int)(scrunch*oldy),
- X (int)newx,(int)(scrunch*newy));
- X oldx = newx;
- X oldy = newy;
- X angle = (mydpy->turth-90.0)*3.141592654/180.0;
- X newx = mydpy->turtx + 15.0*sin(angle);
- X newy = mydpy->turty + 15.0*cos(angle);
- X transline(INVERT,(int)oldx,(int)(scrunch*oldy),
- X (int)newx,(int)(scrunch*newy));
- X scrunch = yscrunch;
- X}
- X
- Xsuninit()
- X{
- X if (gfx_windowfd < 0) {
- X char *parent, *text, *gfx;
- X struct pixfont *pf = pf_default();
- X struct inputmask im;
- X struct screen scr;
- X int sig_mask;
- X
- X sig_mask = sigblock(1 << (SIGWINCH-1));
- X
- X /* Get window numbers from environment */
- X
- X if ((parent = getenv("LOGO_TOOL")) == NULL) {
- X printf("No LOGO_TOOL environment variable\n");
- X printf("Are you running logo instead of logotool?\n");
- X errhand();
- X }
- X if ((text = getenv("LOGO_TEXT")) == NULL) {
- X printf("No LOGO_TEXT environment variable\n");
- X printf("Are you running logo instead of logotool?\n");
- X errhand();
- X }
- X if ((gfx = getenv("LOGO_GFX")) == NULL) {
- X printf("No LOGO_GFX environment variable\n");
- X printf("Are you running logo instead of logotool?\n");
- X errhand();
- X }
- X
- X /* Open windows */
- X
- X if ((parentfd = open(parent, 0)) < 0) {
- X printf("Couldn't open parent window %s\n", parent);
- X printf("Sorry, cannot use the turtle!\n");
- X errhand();
- X }
- X if ((textfd = open(text, 0)) < 0) {
- X printf("Couldn't open ttysubwindow %s\n", text);
- X printf("Sorry, cannot use the turtle!\n");
- X errhand();
- X }
- X if ((real_gfx_fd = open(gfx, 0)) < 0) {
- X printf("Couldn't open takeover window %s\n", gfx);
- X printf("Sorry, cannot use the turtle!\n");
- X errhand();
- X }
- X
- X /* Find out how big we are */
- X
- X win_getrect(parentfd, &tool_rect);
- X
- X /* Create window */
- X
- X if ((gfx_windowfd = win_getnewwindow()) < 0) {
- X printf("Couldn't get a new window\n");
- X printf("Sorry, cannot use the turtle!\n");
- X errhand();
- X }
- X if (win_insertblanket(gfx_windowfd, real_gfx_fd) != 0) {
- X printf("Blanket window failed\n");
- X printf("Sorry, cannot use the turtle!\n");
- X errhand();
- X }
- X gfx_pixwin = pw_open(gfx_windowfd);
- X
- X /*
- X * send input typed into gfxwindow to ttysubwindow;
- X * save mouse movement and buttons for gfxsw;
- X * want non-blocking read for gfxsw
- X */
- X
- X input_imnull(&im);
- X win_setinputcodebit(&im, LOC_MOVE);
- X win_setinputcodebit(&im, MS_LEFT);
- X win_setinputcodebit(&im, MS_MIDDLE);
- X win_setinputcodebit(&im, LOC_WINEXIT);
- X win_setinputmask(gfx_windowfd, &im, NULL, win_fdtonumber(textfd));
- X if (fcntl(gfx_windowfd, F_SETFL, FNDELAY) == -1) {
- X printf("Fcntl failed.\n");
- X printf("Please don't use the mouse!\n");
- X }
- X win_setcursor(gfx_windowfd, &logocur);
- X
- X /* Create retained pixrect and set SIGWINCH catcher */
- X
- X win_screenget(gfx_windowfd, &scr); /* get screen dims */
- X screen_height = scr.scr_rect.r_height;
- X screen_width = scr.scr_rect.r_width;
- X gfx_pixwin->pw_prretained =
- X mem_create(screen_height, screen_width, SCREEN_DEPTH);
- X font_height = pf->pf_defaultsize.y; /* Get the font height */
- X signal(SIGWINCH, setwinchflag);
- X sigsetmask(sig_mask);
- X
- X /* Initialize screen size and display */
- X
- X yscrunch = 1.0;
- X gfx_setsize(0);
- X } else
- X sunstate('s'); /* Just redisplay */
- X}
- X
- Xsunfrom(x,y)
- XNUMBER x,y;
- X{
- X sunoldx = x;
- X sunoldy = y;
- X}
- X
- Xsunto(x,y)
- XNUMBER x,y;
- X{
- X transline(sunpens[penerase], (int)sunoldx,(int)sunoldy,(int)x,(int)y);
- X}
- X
- Xsunstate(which)
- X{
- X struct rect r;
- X
- X win_getrect(parentfd, &r); /* get size of parent */
- X fix_rect(&r);
- X switch (which) {
- X case 's': /* Split screen - leave lines for text */
- X if (tlines > 0) {
- X if (tlines * font_height <= r.r_height) {
- X r.r_top += r.r_height - (tlines*font_height);
- X r.r_height = tlines * font_height;
- X }
- X win_setrect(textfd, &r);
- X putchar('\n');
- X state = 's';
- X break;
- X } /* else fallthrough */
- X case 'f': /* Full screen - size of parent */
- X /* must get rid of text window */
- X r.r_left = r.r_top = -2000;
- X win_setrect(textfd, &r);
- X putchar('\n');
- X state = which; /* could be either s or f */
- X break;
- X case 't': /* Text - move graphics window off screen */
- X win_setrect(textfd, &r);
- X state = 't';
- X break;
- X case 'c':
- X case 'w': /* Clear screen */
- X win_getrect(gfx_windowfd, &r);
- X pw_write(gfx_pixwin, 0, 0,
- X r.r_width, r.r_height,
- X PIX_CLR, NULL, 0, 0);
- X pr_rop(gfx_pixwin->pw_prretained,
- X 0, 0, screen_width, screen_height,
- X PIX_CLR, NULL, 0, 0);
- X break;
- X }
- X}
- X
- Xcheckwindow()
- X{
- X if (gfx_windowfd < 0)
- X return;
- X if (gfx_flags & FIX_PICTURE) {
- X repaint();
- X }
- X if (gfx_flags & FIX_SIZE) {
- X gfx_setsize(1);
- X repaint();
- X }
- X gfx_flags = 0;
- X}
- X
- Xgfx_setsize(redraw)
- Xint redraw;
- X{
- X int newx, newy;
- X struct rect r, p;
- X
- X win_getrect(parentfd, &r);
- X p = r;
- X fix_rect(&r);
- X win_setrect(real_gfx_fd, &r);
- X
- X if (redraw) {
- X sunstate(state);
- X if (p.r_width != tool_rect.r_width)
- X mydpy->xhigh += p.r_width - tool_rect.r_width;
- X if (p.r_height != tool_rect.r_height)
- X mydpy->ylow -= p.r_height - tool_rect.r_height;
- X
- X /* Move turtle inside window if it isn't */
- X
- X newx = mydpy->turtx;
- X newy = mydpy->turty;
- X if (mydpy->turtx > mydpy->xhigh)
- X newx = mydpy->xhigh;
- X if (mydpy->turtx < mydpy->xlow)
- X newx = mydpy->xlow;
- X if (mydpy->turty > mydpy->yhigh)
- X newy = mydpy->yhigh;
- X if (mydpy->turty < mydpy->ylow)
- X newy = mydpy->ylow;
- X if (newx != mydpy->turtx || newy != mydpy->turty) {
- X if (shown)
- X sunturt(1);
- X mydpy->turtx = newx;
- X mydpy->turty = newy;
- X if (shown)
- X sunturt(0);
- X }
- X tool_rect = p;
- X } else {
- X scalex = r.r_width / 2 - 1;
- X scaley = r.r_height - r.r_height / 2 + 1;
- X mydpy->xhigh = r.r_width / 2;
- X mydpy->xlow = -(mydpy->xhigh) + 1;
- X mydpy->yhigh = r.r_height / 2 + 3;
- X mydpy->ylow = -(mydpy->yhigh) + 4;
- X sunstate('s');
- X }
- X}
- X
- Xstatic
- Xsetwinchflag()
- X{
- X struct rect r;
- X
- X win_getrect(parentfd, &r);
- X if (!rect_equal(&r, &tool_rect))
- X gfx_flags |= FIX_SIZE;
- X gfx_flags |= FIX_PICTURE;
- X if (sigwinch_ok)
- X checkwindow();
- X
- X}
- X
- Xrepaint()
- X{
- X struct rect r;
- X
- X win_getrect(gfx_windowfd, &r);
- X pw_damaged(gfx_pixwin);
- X pw_write(gfx_pixwin, 0, 0, r.r_width, r.r_height,
- X PIX_SRC, gfx_pixwin->pw_prretained, 0, 0);
- X pw_donedamaged(gfx_pixwin);
- X}
- X
- Xstruct object *
- Xfill_region()
- X{
- X int x = ltos_xcor((int)mydpy->turtx), y = ltos_ycor((int)mydpy->turty);
- X struct rect r;
- X
- X tcheck();
- X if (shown)
- X sunturt(1);
- X win_getrect(gfx_windowfd, &r);
- X fill(x, y, r.r_width, r.r_height);
- X if (shown)
- X sunturt(0);
- X return((struct object *) 0);
- X}
- X
- X#define getpixel ((*(mpr_d(buf)->md_image+(x>>4))>>(15-(x&15)))&1)
- X#define getline pw_read(buf, 0, 0, gfx_width, 1, PIX_SRC, gfx_pixwin, 0, y); yinbuf = y
- X#define putline pw_vector(gfx_pixwin, leftend, y, rightend, y, PIX_SRC, NEWVALUE)
- X#define didabove (y == oldy+1 && leftend >= oldleft && rightend <= oldright)
- X#define didbelow (y == oldy-1 && leftend >= oldleft && rightend <= oldright)
- X#define savex savedx = x
- X#define restorex x = savedx
- X#define push stack[stackptr++] = x | (y << 16)
- X#define pop x = stack[--stackptr] & 65535; y = stack[stackptr] >> 16
- X#define stacknotempty (stackptr > 0)
- X#define OLDVALUE 0
- X#define NEWVALUE 1
- X#define scanline \
- X savex; \
- X x = leftend; \
- X while (x <= rightend) { \
- X while(x <= rightend && getpixel != OLDVALUE) \
- X x++; \
- X if (x > rightend) \
- X break; \
- X push; \
- X while (x <= rightend && getpixel == OLDVALUE) \
- X x++; \
- X } \
- X restorex
- X
- Xfill(startx, starty, gfx_width, gfx_height)
- Xint startx, starty, gfx_width, gfx_height;
- X{
- X register int x, y, stackptr = 0, savedx;
- X int oldy, leftend, rightend, oldleft, oldright, yinbuf = -1;
- X long stack[1000];
- X struct pixrect *buf;
- X
- X x = startx;
- X y = starty;
- X if (pw_get(gfx_pixwin, x, y) == NEWVALUE) /* in case the pen */
- X pw_put(gfx_pixwin, x, y, OLDVALUE); /* is down and this */
- X buf = mem_create(gfx_width, 1, 1); /* point is written */
- X oldy = y;
- X push;
- X while (stacknotempty) {
- X pop;
- X if (y != yinbuf)
- X getline;
- X if (getpixel == NEWVALUE)
- X continue;
- X savex;
- X x--;
- X while (x >= 0 && getpixel == OLDVALUE)
- X x--;
- X leftend = x + 1;
- X restorex;
- X savex;
- X while (x < gfx_width && getpixel == OLDVALUE)
- X x++;
- X rightend = x - 1;
- X restorex;
- X putline;
- X if (!didabove && y > 0) {
- X y--;
- X getline;
- X scanline;
- X y++;
- X }
- X if (!didbelow && y < gfx_height-1) {
- X y++;
- X getline;
- X scanline;
- X y--;
- X }
- X oldy = y;
- X oldleft = leftend;
- X oldright = rightend;
- X }
- X pr_destroy(buf);
- X}
- X
- Xstruct object *
- Xtext_size(arg)
- Xregister struct object *arg;
- X{
- X int lines;
- X NUMBER ncheck();
- X
- X lines = (int)ncheck(arg);
- X if (lines < 0) {
- X printf("textsize takes a positive input\n");
- X errhand();
- X } else {
- X tlines = lines;
- X }
- X if (state == 's')
- X sunstate('s');
- X}
- X
- Xfix_rect(r)
- Xstruct rect *r;
- X{
- X r->r_width -= 2 * BORDER;
- X r->r_height -= font_height + 1 + BORDER;
- X r->r_top = font_height + 1;
- X r->r_left = BORDER;
- X}
- X
- Xsigwinch_on()
- X{
- X checkwindow();
- X sigwinch_ok = 1;
- X}
- X
- Xsigwinch_off()
- X{
- X sigwinch_ok = 0;
- X}
- X
- END_OF_sun.i
- if test 11542 -ne `wc -c <sun.i`; then
- echo shar: \"sun.i\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f logo.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"logo.c\"
- else
- echo shar: Extracting \"logo.c\" \(3627 characters\)
- sed "s/^X//" >logo.c <<'END_OF_logo.c'
- X
- X/* Parent process which sets up windows and calls logo itself
- X * Ttysw insists on forking, so we need two processes
- X * Written by Philippe Lacroute at Sun Microsystems Inc. 1983
- X */
- X
- X/*
- X * Modified April 1985 for Sun release 2.0 software (PGL)
- X */
- X
- X#include <stdio.h>
- X#include <suntool/tool_hs.h>
- X#include <suntool/ttysw.h>
- X#include <suntool/emptysw.h>
- X
- X#define LOGOBIN "logo"
- X
- Xstruct tool *tool;
- Xstruct toolsw *ttysw, /* tty subwindow */
- X *gfxsw; /* to be overlaid with blanket */
- X
- Xstatic short icon_data[256] = {
- X#include "logo.icon"
- X};
- X
- Xmpr_static(turtle_pr, 64, 64, 1, icon_data); /* icon */
- Xstatic struct icon turtle_icon = {
- X TOOL_ICONWIDTH, TOOL_ICONHEIGHT, NULL,
- X {0, 0, TOOL_ICONWIDTH, TOOL_ICONHEIGHT},
- X &turtle_pr, {0, 0, 0, 0}, NULL, NULL, 0
- X};
- Xstatic int sigwinchcatcher(),
- X sigchldcatcher(),
- X mytoolsigwinchhandler(),
- X (*toolsigwinchhandlercached)();
- Xchar tool_name[] = "Sun Logo 2.0",
- X name[WIN_NAMESIZE];
- Xint pidchld = -1, killchild();
- X
- Xmain(argc, argv)
- Xint argc;
- Xchar *argv[];
- X{
- X char **tool_attrs = NULL;
- X struct rect winsize;
- X char *newargv[512];
- X int c;
- X
- X if (tool_parse_all(&argc, argv, &tool_attrs, tool_name) == -1) {
- X tool_usage(tool_name);
- X exit(1);
- X }
- X tool = tool_make(WIN_NAME_STRIPE, 1,
- X WIN_LABEL, tool_name,
- X WIN_ICON, &turtle_icon, 0);
- X if (tool == NULL) {
- X fprintf(stderr, "Couldn't create tool.\n");
- X fprintf(stderr, "Are you running suntools?\n");
- X exit(1);
- X }
- X tool_free_attribute_list(tool_attrs);
- X
- X toolsigwinchhandlercached = tool->tl_io.tio_handlesigwinch;
- X tool->tl_io.tio_handlesigwinch = mytoolsigwinchhandler;
- X win_getrect(tool->tl_windowfd, &winsize);
- X
- X ttysw = ttysw_createtoolsubwindow(tool, "ttysw",
- X winsize.r_width - 2 * tool_borderwidth(tool),
- X winsize.r_height - tool_borderwidth(tool) - tool_stripeheight(tool));
- X gfxsw = esw_createtoolsubwindow(tool, "gfxsw",
- X winsize.r_width - 2 * tool_borderwidth(tool),
- X winsize.r_height - tool_borderwidth(tool) - tool_stripeheight(tool));
- X
- X /* Gfxsw must be on the bottom of tree */
- X
- X win_remove(gfxsw->ts_windowfd);
- X win_setlink(gfxsw->ts_windowfd, WL_YOUNGERSIB, win_fdtonumber(ttysw->ts_windowfd));
- X win_setlink(gfxsw->ts_windowfd, WL_OLDERSIB, WIN_NULLLINK);
- X win_insert(gfxsw->ts_windowfd);
- X
- X /* set environmanet vars */
- X
- X win_fdtoname(tool->tl_windowfd, name);
- X setenv("LOGO_TOOL", name);
- X win_fdtoname(ttysw->ts_windowfd, name);
- X setenv("LOGO_TEXT", name);
- X win_fdtoname(gfxsw->ts_windowfd, name);
- X setenv("LOGO_GFX", name);
- X
- X /* set signals */
- X
- X signal(SIGWINCH, sigwinchcatcher);
- X signal(SIGCHLD, sigchldcatcher);
- X signal(SIGINT, SIG_IGN);
- X signal(SIGQUIT, SIG_IGN);
- X
- X newargv[0] = LOGOBIN;
- X for (c = 1; c < argc; c++)
- X newargv[c] = argv[c];
- X argv[c] = 0;
- X
- X /* install everything */
- X
- X tool_install(tool);
- X if ((pidchld = ttysw_fork(ttysw->ts_data, newargv, &ttysw->ts_io.tio_inputmask,
- X &ttysw->ts_io.tio_outputmask, &ttysw->ts_io.tio_exceptmask)) == -1) {
- X perror("logotool");
- X exit(1);
- X }
- X
- X /* run the ttysw */
- X
- X tool_select(tool, 1); /* 1 child to wait for */
- X
- X /* clean up */
- X
- X tool_destroy(tool);
- X exit(0);
- X}
- X
- Xstatic
- Xsigchldcatcher()
- X{
- X tool_sigchld(tool);
- X}
- X
- Xstatic
- Xsigwinchcatcher()
- X{
- X tool_sigwinch(tool);
- X if (pidchld != -1)
- X kill(pidchld, SIGWINCH);
- X}
- X
- Xnullfunc()
- X{
- X}
- X
- X/*
- X toolsigwinchhandlercached will rearrange windows when it
- X detects that its size has changed. The following procedure
- X fools toolsigwinchhandlercached into thinking that there
- X has been no change.
- X */
- X
- Xstatic int
- Xmytoolsigwinchhandler(tool)
- X struct tool *tool;
- X{
- X struct rect rect;
- X
- X win_getsize(tool->tl_windowfd, &rect);
- X tool->tl_rectcache = rect;
- X toolsigwinchhandlercached(tool);
- X}
- X
- END_OF_logo.c
- if test 3627 -ne `wc -c <logo.c`; then
- echo shar: \"logo.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f logo.icon -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"logo.icon\"
- else
- echo shar: Extracting \"logo.icon\" \(2212 characters\)
- sed "s/^X//" >logo.icon <<'END_OF_logo.icon'
- X
- X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
- X * Description: A turtle.
- X * Background: Root gray.
- X */
- X 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888,
- X 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- X 0x8888, 0x888B, 0xC888, 0x8888, 0x8888, 0x888F, 0xE888, 0x8888,
- X 0x2222, 0x222F, 0xF222, 0x2222, 0x2222, 0x222F, 0xF222, 0x2222,
- X 0x8888, 0x889F, 0xF888, 0x8888, 0x8888, 0x889F, 0xF888, 0x8888,
- X 0x2222, 0x223F, 0xFA22, 0x2222, 0x2222, 0x223F, 0xFA22, 0x2222,
- X 0x8888, 0x888F, 0xF888, 0x8888, 0x8888, 0x888F, 0xF088, 0x8888,
- X 0x2222, 0x2223, 0xE222, 0x2222, 0x2222, 0x2223, 0xE23A, 0x2222,
- X 0x8888, 0xF88B, 0xC8FC, 0x8888, 0x8889, 0xFC9F, 0xF8FE, 0x8888,
- X 0x2221, 0xFE3F, 0xFFFE, 0x2222, 0x2221, 0xFFDF, 0xFBFE, 0x2222,
- X 0x8889, 0xFFDF, 0xF3FC, 0x8888, 0x8888, 0xFFDF, 0xF7F8, 0x8888,
- X 0x2222, 0x7FDF, 0xF7F2, 0x2222, 0x2222, 0x3FDF, 0xE7E2, 0x2222,
- X 0x8888, 0x8FEF, 0x9FC8, 0x8888, 0x8888, 0x8BF0, 0x7FC8, 0x8888,
- X 0x2222, 0x27FF, 0xFFE2, 0x2222, 0x2222, 0x24FF, 0xFFA2, 0x2222,
- X 0x8888, 0x8EFF, 0xFE28, 0x8888, 0x8888, 0x8F78, 0x7EE8, 0x8888,
- X 0x2222, 0x27BB, 0xBDE2, 0x2222, 0x2222, 0x27BB, 0xB9E2, 0x2222,
- X 0x8888, 0x8FDB, 0xBBE8, 0x8888, 0x8888, 0x8FD9, 0xBBE8, 0x8888,
- X 0x2222, 0x273E, 0x3BE2, 0x2222, 0x2222, 0x277F, 0xFBE2, 0x2222,
- X 0x8888, 0x8EFF, 0xFBE8, 0x8888, 0x8888, 0x8CFC, 0x79E8, 0x8888,
- X 0x2222, 0x23FD, 0x7E22, 0x2222, 0x2222, 0x23FB, 0xBF22, 0x2222,
- X 0x8888, 0x8BF3, 0xDFE8, 0x8888, 0x8888, 0x8FE7, 0xDFF8, 0x8888,
- X 0x2222, 0x3FEF, 0xCFFA, 0x2222, 0x2222, 0x7FCF, 0xEFFE, 0x2222,
- X 0x8888, 0xFFDF, 0xEFFE, 0x8888, 0x8888, 0xFFBF, 0xF8FE, 0x8888,
- X 0x2222, 0xFE2F, 0xE23E, 0x2222, 0x2222, 0xFC2F, 0xE23E, 0x2222,
- X 0x8888, 0xF88F, 0xE88C, 0x8888, 0x8888, 0x888F, 0xE888, 0x8888,
- X 0x2222, 0x222F, 0xE222, 0x2222, 0x2222, 0x222F, 0xE222, 0x2222,
- X 0x8888, 0x8887, 0xC888, 0x8888, 0x8888, 0x888B, 0x8888, 0x8888,
- X 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- X 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888,
- X 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- X 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888, 0x8888,
- X 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222
- X
- X
- END_OF_logo.icon
- if test 2212 -ne `wc -c <logo.icon`; then
- echo shar: \"logo.icon\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f Make.Sun -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"Make.Sun\"
- else
- echo shar: Extracting \"Make.Sun\" \(1031 characters\)
- sed "s/^X//" >Make.Sun <<'END_OF_Make.Sun'
- X
- X# Makefile modified for use on Suns
- X
- XCFLAGS = -O -Usun
- XLIBS = -lsuntool -lsunwindow -lpixrect -lm -ltermlib -lc
- X#LDFLAGS = -X -i
- XLDFLAGS = -X
- X
- Xall: logo logotool logohead
- X
- Xlogo: y.tab.o logoparse.o zerr.o main.o logoop.o logoaux.o unix.o \
- X storage.o turtle.o procedit.o logonum.o procvars.o logoproc.o \
- X proplist.o
- X ld $(LDFLAGS) -o logo /lib/crt0.o *.o $(LIBS)
- X
- Xlogotool: logo.c logo.icon
- X cc -o logotool $(CFLAGS) logo.c -lsuntool -lsunwindow -lpixrect
- X
- Xlogo.c:
- X
- X
- Xturtle.o: atari.i gigi.i adm.i tek.i admtek.i sun.i
- X
- Xy.tab.c: logo.y
- X yacc logo.y
- X
- Xlogohead: logohead.c
- X cc -O -o logohead logohead.c
- X
- Xhelp: splithelp logoman
- X ./makehelp
- X
- Xsplithelp: splithelp.c
- X cc -O -o splithelp splithelp.c
- X
- Xinstall:
- X cp logo /usr/local/logo
- X cp logotool /usr/local/logotool
- X -mkdir /usr/local/lib/logo
- X -mkdir /usr/local/lib/logo/doc
- X cp help/* /usr/local/lib/logo/doc
- X cp helpfile applediff olddiff /usr/local/lib/logo/doc
- X cp library/* /usr/local/lib/logo
- X cp logohead /usr/local/lib/logo
- X
- Xclean:
- X rm *.o logo logotool logohead splithelp
- END_OF_Make.Sun
- if test 1031 -ne `wc -c <Make.Sun`; then
- echo shar: \"Make.Sun\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of shell archive.
- exit 0
- --
-
- Rich $alz "Anger is an energy"
- Cronus Project, BBN Labs rsalz@pineapple.bbn.com
- Moderator, comp.sources.unix sources@uunet.uu.net
-